const promise = new Promise((resolve, reject) => {
    // reject("error"); // rejected
    resolve("success2");
})

promise
    // 链式 
    .then(res => {
        console.log("then1", res);
        let newP = new Promise((resolve, reject) => {
            setTimeout(() => {
                // resolve('newP success')
                reject('newP error')     
            }, 1000)
        })
        return newP
        // Promise.resolve()
    })
    .then(res => {
        console.log("then2", res);
        // return 2;
    })
    // catch  当promise rejected后 执行catch
    .catch(err => {
        console.log("catch", err);
        // return 2
    })
    .then(res => {
        console.log("then3", res);
    })